home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 16
/
AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso
/
pd
/
anwendungen
/
dcf77
/
developer
/
waitfordcf77.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-19
|
1KB
|
57 lines
/* WaitForDCF77 ***RGR***
12-sep-94
Author: Ralf Gruner, Großschönau, Germany.
ralf.gruner@t-online.de
*/
#include <exec/types.h>
#include <exec/semaphores.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
struct StatusList
{
struct SignalSemaphore sl_Semaphore;
STRPTR version;
BOOL Received;
};
struct StatusList *DCF77PublicStatus=NULL;
UBYTE * DCF77SemaphoreName = "DCF77 State";
BOOL DCF77received=FALSE;
main(int argc, char *argv[])
{
char *msg1="\n WaitForDCF77 Version 1.01 - © 1994 Ralf Gruner, Großschönau, Germany.\n";
char *msg2=" WaitForDCF77 waits for received time from the\n european radio clock signal DCF77.";
char *msg3=" Usage: Simply run it while the receiver software DCF77 is running.\n";
if(argc != 1)
{
puts(msg1);
puts(msg2);
puts(msg3);
}
else
while(!DCF77received)
{
Forbid();
if(DCF77PublicStatus=(struct StatusList *) FindSemaphore(DCF77SemaphoreName))
{
ObtainSemaphoreShared((struct SignalSemaphore *) DCF77PublicStatus);
DCF77received=DCF77PublicStatus->Received;
ReleaseSemaphore((struct SignalSemaphore *) DCF77PublicStatus);
}
else
DCF77received=FALSE; // DCF77 is not running
Permit();
if(!DCF77received)
Delay(150L); // wait three seconds and try again...
}
}